import {
    RESET,
    REQUEST_LOADING,
    LOAD_VIN_APPLICATION_LIST_SUCCESS
} from "../action/vin-action";

const initialState = {
    isLoading: false,
    vinApplications: null,
    vinApplicationDetail:null,
    message: null,
    error: null
};

const vinReducer = (state = initialState, action) =>{
    console.log(action)
    switch (action.type) {
        case RESET: {
            return initialState
        }
        case REQUEST_LOADING: {
            return Object.assign({}, state, {
                isLoading: true,
                message: null,
                error: null
            })
        }
        case LOAD_VIN_APPLICATION_LIST_SUCCESS: {
            return Object.assign({}, state, {
                isLoading: false,
                vinApplications: action.payload
            })
        }
        default: {
            return state;
        }
    }
};
export default vinReducer;